//
//  CustomView.m
//  RomensBI
//
//  Created by CcMark on 16/2/27.
//
//

#import "CustomView.h"

@implementation CustomView
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor clearColor]];
        
    }
    return self;
}

-(void)Color:(UIColor *)color{
    CGFloat red, green, blue, alpha;
    [color getRed: &red
           green: &green
           blue: &blue
           alpha: &alpha];
    
    
    self.R = red;
    self.G = green;
    self.B = blue;

}


- (void)drawRect:(CGRect)rect
{
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetRGBStrokeColor(context,_R, _G, _B, 1.0);//画笔线的颜色
    CGContextSetLineWidth(context, 0.0);//线的宽度
    CGContextSetRGBFillColor(context, _R, _G, _B, 1.0);
    CGContextAddArc(context, rect.size.width/2, rect.size.height/2, (rect.size.width)/2, 0, 2*PI, 0); //添加一个圆
    CGContextDrawPath(context, kCGPathStroke); //绘制路径
    
    CGContextFillEllipseInRect(context, rect);
    CGContextStrokeEllipseInRect(context, rect);
    
}
@end
